import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Injectable({
  providedIn: 'root'
})
export class AdvertisingAgencyManageService {

  serviceUrls = {
    advertUserUrl: '/adcraft/user/list', // 查询广告用户列表
    advertUserDetailUrl: '/adcraft/user/info/', // 查询广告用户详情
    advertUserExamineUrl: '/adcraft/user/update', // 审核广告用户

    agencyApplicationUrl: '/adcraft/application/list', // 代理申请列表
    agentAuditUrl: '/adcraft/application/update' // 代理申请审核
  }

  constructor(
    private httpClient: HttpClient,
  ) {}

  // 查询广告用户列表
  getAdvertUserList(params: any) {
    return this.httpClient.post(this.serviceUrls.advertUserUrl, params).toPromise();
  }

  // 查询用户详情
  getDeatilData(params: any) {
    let url = this.serviceUrls.advertUserDetailUrl + params.id
    return this.httpClient.get(url).toPromise();
  }

  // 广告用户审核
  advertUserExamineUpdate(params: any) {
    return this.httpClient.post(this.serviceUrls.advertUserExamineUrl, params).toPromise();
  }

  // 代理申请列表
  agencyApplicationList(params: any) {
    return this.httpClient.post(this.serviceUrls.agencyApplicationUrl, params).toPromise();
  }

  // 代理申请审核
  agentAuditItem(params: any) {
    return this.httpClient.post(this.serviceUrls.agentAuditUrl, params).toPromise();
  }
}
